package com.yjd.comm.message.service;

import com.yjd.comm.base.service.IBaseService;
import com.yjd.comm.message.model.VerifySmsModel;

/**
 * <b>description</b>：短信验证码发送记录业务接口<br>
 * <b>time</b>：2014-11-17 13:15:07 <br>
 * <b>author</b>：  renbangjie_vip@163.com
 */
public interface IVerifySmsService extends IBaseService {
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public VerifySmsModel insert(VerifySmsModel model) throws Exception;

	/**
	 * 更新,大于等于1表示成功，其他失败
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(VerifySmsModel model) throws Exception;

	/**
	 * 根据id删除,大于等于1表示成功，其他失败
	 * 
	 * @param mobile
	 * @return
	 * @throws Exception
	 */
	public int delete(Long mobile) throws Exception;
	
	
	/**
	 * 发送短信
	* @param mobile
	* @return boolean
	* @throws Exception
	 */
	public int sendMessage(String mobile) throws Exception;
	
	/**
	 * 比较短信
	* @param mobile
	* @param code
	* @return boolean
	* @throws Exception
	 */
	public int compareMessageCode(String mobile, String code, int msgCount, int max) throws Exception;
	
	/**
	 * 短信发送和校验的状态
	* @author renbangjie renbangjie@126.com
	* @date 2015-4-15 上午9:25:39
	 */
	public class MessageResult{
		/**
		 * 发送状态
		* @author renbangjie renbangjie@126.com
		* @date 2015-4-15 上午9:26:52
		 */
		public enum SendStatus{
			
			success(0, "成功"),
			frequency(-1000, "一分钟内只能发送一次"),
			max(-1001, "达到最大发送次数"),
			hourmax(-1002,"1小时内最多获取3次");
			
			private int code;
			private String label;
			 
			private SendStatus(int code, String label) {
				this.code = code;
				this.label = label;
			}
			
			public int getCode() {
				return code;
			}
			public void setCode(int code) {
				this.code = code;
			}
			public String getLabel() {
				return label;
			}
			public void setLabel(String label) {
				this.label = label;
			}
			
		}
		
		

		/**
		 * 校验状态
		* @author renbangjie renbangjie@126.com
		* @date 2015-4-15 上午9:26:58
		 */
		public enum ValidStatus{
			success(0, "成功"),
			nullity(-1000, "无效验证码"),
			max(-1001, "已达到最大错误次数,注销验证码"),
			mismatching(-1002, "错误的验证码");
			
			private int code;
			private String label;
			 
			private ValidStatus(int code, String label) {
				this.code = code;
				this.label = label;
			}
			
			public int getCode() {
				return code;
			}
			public void setCode(int code) {
				this.code = code;
			}
			public String getLabel() {
				return label;
			}
			public void setLabel(String label) {
				this.label = label;
			}
		}
		
	}

}
